Skip to content

商户订单号查询 ​

商户可以通过查询订单接口主动查询订单状态,完成下一步的业务逻辑。查询订单状态可通过微信支付订单号或商户订单号两种方式查询

请求参数类型描述
out_trade_nostring商户订单号
queryobject声明请求的查询参数
sp_mchidstring服务商户号
sub_mchidstring子商户号
php
$instance->v3->pay->partner->transactions->outTradeNo->_out_trade_no_->getAsync([
  'out_trade_no' => '1217752501201407033233368018',
  'query' => [
    'sp_mchid'  => '1230000109',
    'sub_mchid' => '1900000109',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/pay/partner/transactions/out-trade-no/{out_trade_no}')->getAsync([
  'out_trade_no' => '1217752501201407033233368018',
  'query' => [
    'sp_mchid'  => '1230000109',
    'sub_mchid' => '1900000109',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/pay/partner/transactions/out-trade-no/{out_trade_no}']->getAsync([
  'out_trade_no' => '1217752501201407033233368018',
  'query' => [
    'sp_mchid'  => '1230000109',
    'sub_mchid' => '1900000109',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->pay->partner->transactions->outTradeNo->_out_trade_no_->get([
  'out_trade_no' => '1217752501201407033233368018',
  'query' => [
    'sp_mchid'  => '1230000109',
    'sub_mchid' => '1900000109',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/pay/partner/transactions/out-trade-no/{out_trade_no}')->get([
  'out_trade_no' => '1217752501201407033233368018',
  'query' => [
    'sp_mchid'  => '1230000109',
    'sub_mchid' => '1900000109',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/pay/partner/transactions/out-trade-no/{out_trade_no}']->get([
  'out_trade_no' => '1217752501201407033233368018',
  'query' => [
    'sp_mchid'  => '1230000109',
    'sub_mchid' => '1900000109',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
sp_appidstring服务商公众号ID
sp_mchidstring服务商户号
sub_appidstring子商户公众号ID
sub_mchidstring子商户号
transaction_idstring微信支付订单号
trade_typestring交易类型
JSAPI | NATIVE | APP | MICROPAY | MWEB | FACEPAY 枚举值之一
trade_statestring交易状态
SUCCESS | REFUND | NOTPAY | CLOSED | REVOKED | USERPAYING | PAYERROR 枚举值之一
trade_state_descstring交易状态描述
bank_typestring付款银行
success_timestring支付完成时间
attachstring附加数据
out_trade_nostring商户订单号
amountobject用户支付金额
payer_totalinteger用户支付金额
payer_currencystring用户支付币种
totalinteger总金额
currencystring货币类型
scene_infoobject场景信息
device_idstring商户端设备号
payerobject支付者
sp_openidstring用户服务标识
sub_openidstring用户子标识
promotion_detailobject[]优惠功能
coupon_idstring券ID
namestring优惠名称
scopestring优惠范围
typestring优惠类型
amountinteger优惠券面额
stock_idstring活动ID
wechatpay_contributeinteger微信出资
merchant_contributeinteger商户出资
other_contributeinteger其他出资
currencystring优惠币种
goods_detailobject[]单品列表
goods_idstring商品编码
quantityinteger商品数量
unit_priceinteger商品单价
discount_amountinteger商品优惠金额
goods_remarkstring商品备注

参阅 官方文档 官方文档 官方文档 官方文档 官方文档 官方文档 官方文档 官方文档 官方文档

Published on the GitHub by TheNorthMemory